package com.gmail.danielrheiniger.imdb;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;

public class IMDB
{
	public static void main(String[] args) throws IOException
	{
		
		String title = new String();
		
		Scanner s = new Scanner(System.in);
		
		System.out.println("Enter a movie title");
		title = s.nextLine();
		
		URL IMDB = new URL("http://www.imdb.com/find?s=tt&q=" + title);
		HttpURLConnection httpcon = (HttpURLConnection) IMDB.openConnection(); 
		httpcon.addRequestProperty("User-Agent", "Mozilla/4.76"); 
		BufferedReader in = new BufferedReader(new InputStreamReader(httpcon.getInputStream()));
		
		String str = in.readLine();
		while(str!=null)
		{
			System.out.println(str);
			str = in.readLine();
		}
		in.close();
	}
	
	
	
}
